package com.ljc.cjgl.entitiy;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import org.springframework.data.annotation.CreatedBy;

import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
public class ActivityAttachment {
	private Integer	id;
	@JsonIgnore
	private ClassActitvity activity;
	private String creator;
	private String title;
	private String demo;
	private Integer type; //0:照片，1:文件
	private String fileName;
	private String uid;
	
	public ActivityAttachment(Integer id) {
		super();
		this.id = id;
	}

	public ActivityAttachment() {
		super();
	}
	
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	@ManyToOne
	@CreatedBy
	public ClassActitvity getActivity() {
		return activity;
	}

	public void setActivity(ClassActitvity activity) {
		this.activity = activity;
	}
	

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDemo() {
		return demo;
	}

	public void setDemo(String demo) {
		this.demo = demo;
	}
	
	
	@Transient
	public Integer getActivityId() {
		return activity==null?null:activity.getId();
	}
	
	@Transient
	public String getActivityName() {
		return activity==null?null:activity.getName();
	}
	
	@Transient
	public Integer getClassId() {
		return activity==null?null:activity.getTbClass().getId();
	}
	
	@Transient
	public String getClassName() {
		return activity==null?"":activity.getTbClass().getName();
	}
	
	@Column(length=20)
	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}
	
	
}
